#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
void resve(int a[][101], int n)
{
	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= n; j++)
		{
			scanf("%d", &a[i][j]);
		}
	}

}

void xj(int a[][101], int n)
{
	for (int k = n; k >= 1; k--)
	{
		printf("%d\n", a[2][2]);
		for (int i = 1; i <= k; i++)
		{
			int x = a[i][1];
			for (int j = 1; j <= k; j++)
			{
				if (a[i][j] < x)
					x = a[i][j];
			}
			for (int j = 1; j <= k; j++)
			{
				a[i][j] -= x;
			}
		}
		for (int j = 1; j <= k; j++)
		{
			int x = a[1][j];
			for (int i = 1; i <= k; i++)
			{
				if (a[i][j] < x)
					x = a[i][j];
			}
			for (int i = 1; i <= k; i++)
			{
				a[i][j] -= x;
			}
		}
		for (int i = 2; i < k; i++)
		{
			for (int j = 1; j <= k; j++)
			{
				a[i][j] = a[i + 1][j];
			}
		}
		for (int j = 2; j < k; j++)
		{
			for (int i = 1; i <= k; i++)
			{
				a[i][j] = a[i][j + 1];
			}
		}

	}
}
int main()
{
	int a[101][101];
	int n;
	scanf("%d", &n);
	resve(a, n);
	xj(a, n);
	return 0;
}